/*
 * @Author: yang-tengyuyxd 1282291612@qq.com
 * @Date: 2024-10-31 11:15:42
 * @LastEditors: yang-tengyuyxd 1282291612@qq.com
 * @LastEditTime: 2024-10-31 12:42:37
 * @FilePath: /yxd/管道/命名管道/Server.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "Server.hpp"
#include <iostream>

int main()                                                     //服务端
{
    // Server s;   把管道文件放在Server.cc

    Server server;
    std::cout<<"pos 1"<<std::endl;
    server.OpenPipeForRead();
    std::cout<<"pos 2"<<std::endl;

    std::string message;
    while(1)
    {
        if(server.RevPipe(&message)>0)
        {
        std::cout<<"client say# "<<message<<std::endl;
        }
        else
        {
            break;
        }
    std::cout<<"pos 3"<<std::endl;

    }
    std::cout<<"client quit,me too!"<<std::endl;

    server.ClosePipe();

    return 0;
}